<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" type="image/gif" href="slike/animated_favicon1.gif">
<script src="skripte/Cookies.js"></script>
<script src="skripte/proba1.js"></script>
<script src="jQuery/jquery-1.10.2.js"></script>
<script src="skripte/urlParam.js"></script>

<LINK href="stilovi/coda-slider.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/templatemo_style.css" rel="stylesheet" type="text/css">
<script src="skripte/WSRole.js" charset="UTF-8"></script>
<link rel="icon" type="image/gif" href="slike/animated_favicon1.gif">
<LINK href="stilovi/srednjeDugme.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/role.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/navigacija.css" rel="stylesheet" type="text/css">
<script src="skripte/kreirajNavigaciju.js" charset="UTF-8"/></script>
<title>Dodjeljivanje role</title>

</head>
<body>

<div id="slider">
 
	<div id="templatemo_main">
    	<ul id="social_box">
            <h1> Javna saobraćajna mreža Bosne i Hercegovine </h1>         
        </ul>
        
        <div id="content">
     
            <div class="scroll">
                <div class="scrollContainer">
                
                    <div class="panel" id="home">             
                        <div id="navigacija"></div>
<div id="korisnik">
<p>Korisnik:</p>
</div>
<h4>Postojeće role:</h4>
<div id="sve_role" >
<table id="tblRole" border=0 align="left">
</table>
</div>
<br>&nbsp;<br>
<div id="dugmeDiv" align="left" style="clear:both">
<button type="button" onclick="novaRola()">Nova</button>
<button type="button"  onclick="spremiIzmjene()">Spremi Izmjene</button>
</div>
<div id="nova_Rola" style="visibility: hidden;clear:both;" >
<form name="forma1">
<input type="text" id="nazivR">
<button type="button" id="addR" onClick="upisiRolu()">Dodaj novu rolu</button>
</form>
</div>
<script>
navigacija();
$('#korisnik p').append("<b>"+GetURLParameter('korisnik')+"</b>");
var korisnik=GetURLParameter('korisnik');
var role=new Array();
var chek=new Array();

function novaRola()
{
	$('#nova_Rola').css("visibility","visible");
}
function upisiRolu()
{
	var ulaz=$('#nazivR').val();
	kreirajRolu(ulaz,korisnik);
	
}
function spremiIzmjene()
{
	var sveUredu=true;
	for(var i=0;i<role.length;i++)
		{
		spremiIzmjeneRole(role[i],korisnik,$('input[name='+role[i]+']').prop('checked'))
		}
	if(sveUredu) alert("Izmjene su spašene u bazu!");
}
function insertRole(arg,chekiran)
{
	role.push(arg);
	chek.push(chekiran);
	var fja="podesiPermisije('"+arg+"')";
	$('#tblRole').append("<tr>"
		+"<td><input type='checkbox' name='"+arg+"' value='"+arg+"'>"+arg+"</td>"
		+"<td><button type='button' onClick="+fja+">Podesi permisije</button></td></tr>");
	
	if(chekiran=='true')
		{
		$('input[name='+arg+']').prop('checked',true);
		
		}
		
	$('#nova_Rola').css("visibility","hidden");
}
function podesiPermisije(kome)
{
	self.location=("permisije.html?rola="+kome);
}
ucitajRole(korisnik);
</script>
						
        	        </div> 
        	            
     
			</div>
 
        
        </div> 
    </div>
    
    </div> 
</div>

</body>
</html>